<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	String appPath = request.getContextPath();
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<script type="text/javascript" src="${staticPath}/pcjs/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="${staticPath}/js/jquery.cookie.js"></script>
<script type="text/javascript" src="${staticPath}/js/jquery.md5.js"></script>
<script type="text/javascript" src="${staticPath}/js/validate.js"></script>
<script type="text/javascript">var appPath="<%=appPath%>";
</script>
<script type="text/javascript">
	var staticPath = "${staticPath}";
</script>
<div id="cover" class="cover"></div>
<div class="popup" id="popup" style="height: 120px; display: none;">
	<div style="text-align: center; line-height: 40px; font-size: 15px;">
		<label>提示</label>
	</div>
	<div style="text-align: center; line-height: 40px; font-size: 12px; color: #888">
		<label id="message"></label>
	</div>
	<div id="alertClose" style="border-top: 1px rgba(220, 220, 220, 0.8) solid; text-align: center; line-height: 40px; font-size: 15px; color: #6091ed">
		<label>确定</label>
	</div>
</div>
<div class="popup" id="loading" style="height: 60px; width: 60px; background: transparent; border: none; display: none;">
	<img src="${staticPath}/pcimages/loading.gif" />
</div>
<div class="popup" id="confirm" style="height: 120px; display: none;">
	<div style="text-align: center; line-height: 40px; font-size: 15px;">
		<label>提示</label>
	</div>
	<div style="border-bottom: 1px rgba(220, 220, 220, 0.8) solid; text-align: center; line-height: 40px; font-size: 12px; color: #888">
		<label id="confirmMessage"></label>
	</div>
	<div id="confrimCancel"
		style="float:left; display: inline-block; width: 263px; border-right: 1px rgba(220, 220, 220, 0.8) solid; text-align: center; line-height: 40px; font-size: 15px; color: #888">
		<label>取消</label>
	</div>
	<div id="confrimOk" style="float:left; display: inline-block; width: 263px; text-align: center; line-height: 40px; font-size: 15px; color: #6091ed">
		<label>确定</label>
	</div>
</div>
<script type="text/javascript">
	function gotoHtml(url) {
		var tmp = "?";
		if (url.indexOf("?") >= 0) {
			tmp = "&";
		}
		var token=$.cookie("token");
		if (typeof(token) == "undefined") { 
			window.location.href = appPath + url;
		}else{
			window.location.href = appPath + url + tmp + "token="+ token;
		}  
	}
	function reloadHtml() {
		window.location.reload();
	}
	function myalert(message, func) {
		$('#message').text(message);
		$("#cover").show();
		$("#popup").show();//查找ID为popup的DIV show()显示#gray
		tc_center();
		$("#alertClose").unbind('click');
		$("#alertClose").click(function() {
			$("#cover").hide();
			$("#popup").hide();//查找ID为popup的DIV hide()隐藏
			if (func != null) {
				func();
			}
		})
	};
	function myconfirm(message, func) {
		$('#confirmMessage').text(message);
		$("#cover").show();
		$("#confirm").show();//查找ID为popup的DIV show()显示#gray
		tc_center_confirm();
		$("#confrimOk").unbind('click');
		$("#confrimOk").click(function() {
			$("#cover").hide();
			$("#confirm").hide();//查找ID为popup的DIV hide()隐藏		
			if (func != null) {
				func();
			}
		})
		$("#confrimCancel").unbind('click');
		$("#confrimCancel").click(function() {
			$("#cover").hide();
			$("#confirm").hide();//查找ID为popup的DIV hide()隐藏

		})
	};
	function showLoading() {
		$("#cover").show();
		$("#loading").show();
		tc_center_loading();
	};

	function hideLoading() {
		$("#cover").hide();
		$("#loading").hide();
	};

	//窗口水平居中
	$(window).resize(function() {
		tc_center();
		tc_center_loading();
		tc_center_confirm
	});

	function tc_center() {
		var _top = (screen.height - $("#popup").height()) / 3
				+ $(window).scrollTop() - 85;
		var _left = (screen.width - $("#popup").width()) / 2
				+ $(window).scrollLeft();
		$("#popup").css({
			top : _top,
			left : _left
		});
	}

	function tc_center_loading() {
		var _top = (screen.height - $("#loading").height()) / 2 - 50
				+ $(window).scrollTop() - 85;
		var _left = (screen.width - $("#loading").width()) / 2
				+ $(window).scrollLeft();
		$("#loading").css({
			top : _top,
			left : _left
		});
	}
	function tc_center_confirm() {
		var _top = (screen.height - $("#confirm").height()) / 3
				+ $(window).scrollTop() - 85;
		var _left = (screen.width - $("#confirm").width()) / 2
				+ $(window).scrollLeft();
		$("#confirm").css({
			top : _top,
			left : _left
		});
	}
	jQuery.extend({
		alert : function(message, func) {
			myalert(message, func);
		},
		showLoading : function(message, func) {
			showLoading(message, func);
		},
		hideLoading : function(message, func) {
			hideLoading(message, func);
		}
	});
	function gotoHtmlTarget(url,target) {
		var tmp = "?";
		if (url.indexOf("?") >= 0) {
			tmp = "&";
		}
		if("1"==target){
			window.open(appPath + url + tmp + "token="+ $.cookie("token"));			
		}else{
			window.location.href = appPath + url + tmp + "token="
					+ $.cookie("token");
		}
	}

	function reloadVerifyCode(id) {
		var timenow = new Date().getTime();
		$("#" + id).attr("src", appPath + "/member/getImageCode.htm?" + timenow);
	}
</script>
